package com.javaspeak.algorithm.reversearray;

/**
 * Write a class that efficiently reverses an array of Strings
 *
 * @author John Dickerson
 */
public class Reverse {

    public static void reverse( String[] names ){

        int length = names.length;
        String first;

        for ( int i=0; i<length/2; i++ ){

            first =  names[ i ];
            names[ i ] = names[ length - i - 1 ];
            names[ length - i - 1 ] = first;
        }

        for ( String name : names ){

            System.out.println( name );
        }
    }
}
